package com.jims.master.modules.med.web;

import com.jims.master.common.web.Dto;
import com.jims.master.common.web.impl.BaseDto;
import com.jims.master.modules.med.service.HisVsMedicalService;
import com.jims.master.modules.med.service.MedicalComService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @Author 陈晓阳
 * @desc
 * @<p>
 *     医保调用接口专用
 * </p>
 */
@Controller
@RequestMapping(value = "${adminPath}/med/medicalCom")
public class MedicalComController {

    @Autowired
    private MedicalComService medicalComService;

    @Autowired
    private HisVsMedicalService hisVsMedicalService;

    /**
     * 4.2.1获取个人信息
     * @return
     */
    @RequiresPermissions("user")
    @RequestMapping(value = {"getPersonInfo", ""})
    @ResponseBody
    public Dto getPersonInfo(){
        Dto returnVal=new BaseDto();
        Dto dto=medicalComService.medicalMethod("Open", "");
        boolean isSuccess=dto.getAsBoolean("isSuccess");
        if(isSuccess){
            //打开读卡设备成功 --可以调用获取个人信息接口
            returnVal=medicalComService.medicalMethod("GetPersonInfo", "");
        }else{
            returnVal=dto;
        }
        return returnVal;
     }

    /**
     * 费用分解接口 Divide
     * @param inParams 代收费 clinicOrdersIds
     * @return
     */
    @RequiresPermissions("user")
    @RequestMapping(value = {"divide", ""})
    public Dto prepareMedData(@RequestParam("inParams") String inParams,@RequestParam("flag") String flag){
        if("cd".equalsIgnoreCase(flag)){
            //承德医保
            //1 组织数据
            //2 插入数据
            return null;
        }else{
            return medicalComService.divide(inParams);
        }
    }






}
